use std::path::Path;

use crate::local_json_file::{self, LocalSetting};

#[tauri::command]
pub async fn read_local_settings() -> Option<LocalSetting> {
    local_json_file::read_local_setting().await
}

#[tauri::command]
pub async fn open_path(path: String) -> String {
    local_json_file::open_path(path).await
}

#[tauri::command]
pub async fn save_local_setting(local_setting: LocalSetting) {
    local_json_file::save_local_setting(local_setting).await
}

#[tauri::command]
pub fn get_file_icon_base64(file_path: &Path) -> String {
    local_json_file::get_file_icon_base64(file_path)
}

#[tauri::command]
pub fn check_path_existence(path: &Path) -> bool {
    local_json_file::check_path_existence(path)
}

#[tauri::command]
pub async fn check_path_type(path: &Path) -> Result<String, String> {
    Ok(local_json_file::check_path_type(path).await)
}

#[tauri::command]
pub fn exit_app(app: tauri::AppHandle) {
    app.exit(0);
}
